﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class FinalFlag : MonoBehaviour
{
    public GameObject ball;

    void Start()
	{
		Time.timeScale = 1f;
	}

	void OnCollisionEnter2D (Collision2D other)
	{

		if (other.gameObject.CompareTag ("Ball"))
        {
            ball.SetActive(false);
            StartCoroutine(InstantiateAfterDelay(1.2f));
        }
	}

    IEnumerator InstantiateAfterDelay(float delay)
    {
        yield return new WaitForSeconds(delay);
        SceneManager.LoadScene("Level 41");
    }
}